public class UserHelper
{
    Dictionary<string, string> list_u = new Dictionary<string, string>();
    public UserHelper()
    {
        list_u.Add("sa", "123456");
    }
    public string checke_token(string uuid)
    {
        string path = AppDomain.CurrentDomain.BaseDirectory + "token/" + uuid + ".token";
        string userpwd = th.ReadTXT(path);
        string[] arr = userpwd.Split('-');
        string user = arr[0];
        string pwd = arr[1];
        if (check_user_pwd(user, pwd))
        {
            return user;
        }
        return "";
    }
    TextHelper th = new TextHelper();

    public void create_token(string user)
    {
        string uuid = System.Guid.NewGuid().ToString("N");
        string path = AppDomain.CurrentDomain.BaseDirectory + "token/" + uuid + ".token";
        th.WritTXT(path, user);
    }
    public bool check_user_pwd(string inuser, string inpwd)
    {
        try
        {
            string pwd = list_u[inuser];
            if (inpwd == pwd)
            {
                create_token(inuser + "-" + inpwd);
                return true;
            }
        }
        catch
        {

        }
        return false;
    }
    public bool check_user_pwd(userlogon ul)
    {
        return check_user_pwd(ul.user, ul.pwd);
    }
}